package com.dnw.util;

import android.webkit.JavascriptInterface;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.dnw.httpUtil.ApiRetrofit;
import com.dnw.modle.Result;
import com.dnw.response.VideoPathResponse;
import com.socks.library.KLog;

import java.util.List;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2017/2/9 0009.
 */

public abstract class DoLikeOr {


    public void sendRequest(String jokeId, String userId, String userOperateEnum) {
        ApiRetrofit.getInstance().getApiService().doFunnysLikeOr(jokeId, userId, userOperateEnum).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<Result>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        KLog.e(e.getLocalizedMessage());
                        onDecodeError();
                    }

                    @Override
                    public void onNext(Result response) {
                        onSuccess(response.msg);
                    }
                });
    }


    public abstract void onSuccess(String msg);

    public abstract void onDecodeError();

}
